from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.webdriver import WebDriver

from appium0704.appiumpo.BasePage import BasePage
from appium0704.appiumpo.EditMemberPage import EditMemberPage


class AddMemberPage(BasePage):
    _add_member_element = (MobileBy.XPATH, "//*[@text='手动输入添加']")
    def click_addmember_menual(self):
        #点击添加成员
        self.find_and_click(*self._add_member_element)

        return EditMemberPage(self.driver)

    def get_result(self):
        print(self.driver.page_source)
        # toast展示2-3秒自动小时，隐士等待时间内可以完成查找
        # result = self.driver.find_element(MobileBy.XPATH, "//*[@class='android.widget.Toast']").get_attribute(
        #     "text")
        result = self.get_toast_text()
        return result
